<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>问卷管理</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.1.6/semantic.min.css">
    <style>
        .ui.container {
            padding-top: 1.5rem;
        }

        .ui.container[v-cloak] {
            display: none;
        }
    </style>
</head>
<body>
<div class="ui container" id="main" v-cloak>
    <a class="ui green button" href="/manage/questionnaire/add">添加问卷</a>
    <a class="ui blue button" href="/manage/questions">题库</a>
    <a class="ui orange right floated button" href="/manage/logout">注销</a>
    <table class="ui celled table" v-if="questionnaires.length>0">
        <thead>
        <tr>
            <th>题目</th>
            <th class="collapsing">题目数</th>
            <th class="collapsing">状态</th>
        </tr>
        </thead>
        <tbody>
        <tr v-for="questionnaire in questionnaires">
            <td>
                <a href="/manage/questionnaire/{{questionnaire._id}}">{{questionnaire.title}}</a>
            </td>
            <td class="collapsing center aligned">{{questionnaire.questions.length}}</td>
            <td class="collapsing" v-if="questionnaire.isPublished">已发布</td>
            <td class="collapsing" v-else>未发布</td>
        </tr>
        </tbody>
    </table>
    <div class="ui message" v-else>
        未找到问卷
    </div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.10/vue.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fetch/0.10.1/fetch.min.js"></script>
<script src="/manage/js/questionnaires.js"></script>
</body>
</html>